<?php
/**
 * (ajax)
 */
namespace App\Admin\Ajax\Delivery;

use App\Models\Delivery\FBADelivery;
use Illuminate\Support\Facades\DB;
class FbaExAjax {

    /**
     * 批量更新FBA发货单（异常）
     * @param $param
     * @return \Illuminate\Http\JsonResponse
     */
    public function batchChecked($param){
        try{
            DB::beginTransaction();
            foreach ($param as $id){
                $delivery = FBADelivery::query()->find($id);
                $delivery->ex_status = 2; //2：正常
                $delivery->save();
            }
            DB::commit();
            return response()->json(['status' => true,'message' => '操作成功！']);
        }catch (\Exception $e){
            DB::rollBack();
            report($e);
            return response()->json(['status' => false, 'message' => '系统异常！']);
        }
    }
}
